<h2>mach_port_deallocate</h2>
<hr>
<p>
<strong>Function</strong> - Decrement the target port right's user reference count.
<h3>SYNOPSIS</h3>
<pre>
<strong>kern_return_t   mach_port_deallocate</strong>
                <strong>(ipc_space_t</strong>                               <var>task</var>,
                 <strong>mach_port_name_t</strong>                          <var>name</var><strong>);</strong>
</pre>
<h3>PARAMETERS</h3>
<dl>
<p>
<dt> <var>task</var> 
<dd>
[in task send right]
The task holding the right.
<p>
<dt> <var>name</var> 
<dd>
[in scalar]
The task's name for the right.
</dl>
<h3>DESCRIPTION</h3>
<p>
The <strong>mach_port_deallocate</strong> function releases a user reference
for a right.  It is 
an alternate form of <strong>mach_port_mod_refs</strong> that allows
a task to release a user 
reference for a send or send-once right without failing if the
port has died and 
the right is now actually a dead name.
<p>
If <var>name</var> denotes a dead name, send right, or send-once right,
then the right loses 
one user reference.  If it only had one user reference, then
the right is destroyed. 
If <var>name</var> does not denote an element in the port name space, the
function returns 
success.
<h3>NOTES</h3>
<p>
This interface is machine word length specific because of the port name
parameter.
<h3>RETURN VALUES</h3>
<dl>
<p>
<dt> <strong>KERN_INVALID_RIGHT</strong>
<dd>
The <var>name</var> parameter denoted an invalid right.
</dl>
<h3>RELATED INFORMATION</h3>
<p>
Functions:
<a href="mach_port_allocate.html"><strong>mach_port_allocate</strong></a>,
<a href="mach_port_allocate_name.html"><strong>mach_port_allocate_name</strong></a>,
<a href="mach_port_mod_refs.html"><strong>mach_port_mod_refs</strong></a>.
